<template>
  <div>
    <h1>day09组件</h1>
    <button @click="btn()">调取学生信息接口</button>
    <!-- ------登录------ -->
    账号：<input type="text" v-model="logoData.mobile">
    密码：<input type="password" v-model="logoData.password">
    <button @click="logoBtn()">登录</button>
    <!-- ------获取列表------ -->
    <button @click="listBtn()">获取列表数据</button>
  </div>
</template>

<script>
import serive from '../api/requerst'
import {getS} from '../api/apis'

export default {
    name:"MyDay09",
    data() {
        return {
            logoData:{
                mobile: "13800000002",
                password: "hm#qd@23!"
            }
        }
    },
    methods:{
        async btn(){
            const datas = await serive.get("/api1/student");
            console.log(datas);
        },
        // 登录功能
        async logoBtn(){
            const {data} = await serive.post("/api3/api/sys/login",this.logoData);
            console.log(data.data);
            console.log(data.message);
            sessionStorage.setItem("token",data.data)
        },
        // 获取列表数据
        async listBtn(){
            // const {data} = await serive.get(
            //     `/api3/api/company/department`);
            // console.log(data);
            const {data} = await getS(`/department`);
            console.log(data);

        }
    }
}
</script>

<style>

</style>